package br.com.cadele.beans;

import java.io.Serializable;
import java.util.ArrayList;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

import br.com.cadele.model.Aluno;
import br.com.cadele.service.AlunoService;

@ManagedBean(name="visualizarAlunoBean")
@ViewScoped
@URLBeanName(value="visualizarAlunoBean")
@URLMapping(id="visualizarAlunoBean", pattern="/aluno/visualizar", viewId="/pages/aluno/visualizar.xhtml")
public class VisualizarAlunoBean implements Serializable{
	
	private static final long serialVersionUID = -8717589191782914909L;
	Aluno aluno;
    private AlunoService alunoService;
    private ArrayList<Aluno> alunoList;

    @PostConstruct
    public void init(){
        alunoService = new AlunoService();
        alunoList = alunoService.getAll();
    }
    
    public void salvar() {
			alunoService.executeInsert(aluno);
    }
    
    public ArrayList<Aluno> getAlunoList(){
      return alunoList;
    }
    
    public void setAlunoList(ArrayList<Aluno> alunoList){
      this.alunoList = alunoList;
    }
}
